package day9;

import java.util.Scanner;

public class TakeSquareRootTest {
	public static void main(String[] args) throws TakeSquareRootOfNegativeNumberException  {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入一个数：");
		//String chr = scanner.next();
		int num = scanner.nextInt();
		//Integer num = Integer.parseInt(chr);
		System.out.println(num);
		if(num < 0) {
			//throw new TakeSquareRootOfNegativeNumberException();
			throw new TakeSquareRootOfNegativeNumberException(num);
		}
		else {
		System.out.println(Math.sqrt(num));
	    }
	}
	public static void takesquareroot(int num) {
		Math.sqrt(num);
	}
	
}
